<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/jobseeker/tmpl/jobsearchresults.php
 ^ 
 * Description: template view job search results
 ^ 
 * History:		NONE
 ^ 
 */
 
defined('_JEXEC') or die('Restricted access');

JHtml::_('behavior.formvalidation');

$document =& JFactory::getDocument();
$document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);

$link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=job_searchresults&Itemid='.$this->Itemid;

$allowed = false;
if (isset($this->userrole->rolefor) && $this->userrole->rolefor != '' && $this->userrole->rolefor == 2){
    // job seeker
    $allowed = true;
}
 ?>
  
<div class="content-left">
    <div class="box-list-job">
 
        <div class="job-view-left">
            <ul class="job-tab">
                <li>
                    <a href="#" rel="browse">Browse</a>
                </li>
                <li class="active">
                    <a href="#" rel="search">Search</a>
                </li>
            </ul>    

            <div class="job-search-tab">
		<form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=job_searchresults&Itemid='. $this->Itemid); ?>" method="post" name="adminForm" id="adminForm">
                    <div class="job-button-search">
                    	<input type="submit" name="submit_app" onclick="document.adminForm.submit();" value="" />
                    </div>
                    <div class="job-search-words">
                        <h3>Keyword</h3>
                        <input type="text" name="keyword" class="inputbox" value="" />
                    </div>
                    <div class="job-check-box">
			<h3>Most recent</h3>
			<div class="most-recent-option">
                            <input type="radio" name="last-day" value="1" id="last-1day" /> <label for="last-1day">Last 1 day</label>
                            <input type="radio" name="last-day" value="3" id="last-3day"/> <label for="last-3day">Last 3 days</label>
                            <input type="radio" name="last-day" value="" id="last-all"/> <label for="last-all">All</label>
			</div>
                    </div>
                    <div class="job-check-box">
                        <h3>Industry</h3>
                        <div class="job-tree-view">
                        <?php if(count($this->listcategories)) {
                            echo '<ul>';
                            foreach ($this->listcategories as $category) {
                                echo '<li>';
                                echo '<input type="checkbox" name="categories[]" value="' . $category['value'] . '" /> ';
                                echo '<label>' . $category['text'] . '</label>';
                                if(count($category['subcats'])){
                                    echo '<ul>';
                                    foreach($category['subcats'] as $subcategory) {
                                        echo '<li>';
                                        echo '<input type="checkbox" name="subcats[]" value="' . $subcategory['value'] . '" /> ';
                                        echo '<label>' . $subcategory['text'] . '</label>';
                                        echo '</li>';
                                    }
                                    echo '</ul>';
                                }
                                echo '</li>';
                            }
                            echo '</ul>';
                        }
                        ?>
                        </div>
                    </div>
                    <div class="job-check-box">
                        <h3>Job Level</h3>
                        <?php
                            if(count($this->listcareerlevels)){
                                echo '<ul>';
                                foreach($this->listcareerlevels as $careerlevel){
                                    echo '<li><input type="checkbox" name="careerlevels[]" value="' . $careerlevel['value'] . '" /> <label>' . $careerlevel['text'] . '</label></li>';
                                }
                                echo '</ul>';
                            }
                        ?>
                    </div>
                    <div class="job-check-box">
                        <h3>Location</h3>
                        <div class="job-tree-view">
                        <?php
                            if(count($this->listcountries)){
                                echo '<ul>';
                                foreach($this->listcountries as $country){
                                    if($country['value'] == '')
                                        continue;
                                    echo '<li><input type="checkbox" name="countries[]" value="' . $country['value'] . '" /> <label>' . $country['text'] . '</label></li>';
                                }
                                echo '</ul>';
                            }
                        ?>
                            <ul>
                                <li>
                                    <input type="checkbox" /> <label><strong>UK</strong></label>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="job-check-box">
                        <h3>Hour</h3>
                        <?php
                            if(count($this->listjobtypes)){
                                echo '<ul>';
                                foreach($this->listjobtypes as $listjobtype){
                                    echo '<li><input type="checkbox" name="jobtypes[]" value="' . $listjobtype['value'] . '" /> <label>' . $listjobtype['text'] . '</label></li>';
                                }
                                echo '</ul>';
                            }
                        ?>
                    </div>
                    <div class="job-button-search">
                        
                        <input type="submit" name="submit_app" onclick="document.adminForm.submit();" value="" />
                        <input type="hidden" name="view" value="jobseeker" />
			<input type="hidden" name="layout" value="job_searchresults" />
			<input type="hidden" name="uid" value="<?php echo $this->uid; ?>" />
			<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
                        <input type="hidden" name="filterjob" value="1" />
			<input type="hidden" name="task11" value="view" />
                        
                    </div>
                    
                </form>	
            </div>
            <?php //Start Browse Job Tab ?>
            <div class="browse-job-tab" style="display: none;">
                <div class="browse-job-words">
                    <p>Browse jobs by:</p>
                </div>
                <div class="job-option-block">
                    <div class="job-option-block-header active">
                        <h3>Industry</h3>
                        <a href="#">Expanse</a>
                    </div>
                    <div class="job-option-block-content">
                    <?php if ( isset($this->categories) ){ ?>
                        <ul class="default-list">
                        <?php $i = 0; ?>
                        <?php foreach($this->categories as $category){ ?>
                            <?php 
                                $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat='. $category->id .'&Itemid='.$this->Itemid;
                                $lnks = JRoute::_($lnks);
                            ?>
                            <li><a href="<?php echo $lnks; ?>" ><?php echo $category->cat_title; ?></a> <span>(<?php echo $category->catinjobs; ?>)</span></li>
                            <?php
                                $i += 1;
                                if($i >= 3)
                                    break;
                            ?>
                        <?php } ?>
                        </ul>
                        <?php if(count($this->categories) > 2){ ?>
                            <ul class="more-list">
                                <?php foreach($this->categories as $category){ ?>
                                    <?php 
                                        $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat='. $category->id .'&Itemid='.$this->Itemid;
                                        $lnks = JRoute::_($lnks);
                                    ?>
                                <li><a href="<?php echo $lnks; ?>" ><?php echo $category->cat_title; ?></a> <span>(<?php echo $category->catinjobs; ?>)</span></li>
                                <?php } ?>
                            </ul>
                            <div class="job-option-block-more">
                                <a href="#">See more...</a>
                            </div>
                        <?php } ?>
                    <?php } ?>
                    </div>
                </div>
                <div class="job-option-block">
                    <div class="job-option-block-header active">
                        <h3>Location</h3>
                        <a href="#">Expanse</a>
                    </div>
                    <div class="job-option-block-content">
                        <?php if ( isset($this->locations) ){ ?>
                            <ul class="default-list">
                            <?php $i = 0; ?>
                            <?php foreach($this->locations as $location){ ?>
                                <?php 
                                    $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                    $lnks = JRoute::_($lnks);
                                    $lnks = $lnks . '?jobcountry='. $location->code;
                                ?>
                                <li><a href="<?php echo $lnks; ?>" ><?php echo $location->name; ?></a> <span>(<?php echo $location->locationinjobs; ?>)</span></li>
                                <?php
                                    $i += 1;
                                    if($i >= 3)
                                        break;
                                ?>
                            <?php } ?>
                            </ul>
                            <?php if(count($this->locations) > 2) { ?>
                                <ul class="more-list">
                                <?php foreach($this->locations as $location){ ?>
                                    <?php 
                                        $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                        $lnks = JRoute::_($lnks);
                                        $lnks = $lnks . '?jobcountry='. $location->code;
                                    ?>
                                    <li><a href="<?php echo $lnks; ?>" ><?php echo $location->name; ?></a> <span>(<?php echo $location->locationinjobs; ?>)</span></li>
                                <?php } ?>
                                </ul>
                                <div class="job-option-block-more">
                                    <a href="#">See more...</a>
                                </div>
                            <?php } ?>
                        <?php } ?>
                    </div>
                </div>
                <div class="job-option-block">
                    <div class="job-option-block-header active">
                        <h3>Job type</h3>
                        <a href="#">Expanse</a>
                    </div>
                    <div class="job-option-block-content">
                        <?php if ( isset($this->jobtypes) ){ ?>
                            <ul class="default-list">
                            <?php $i = 0; ?>
                            <?php foreach($this->jobtypes as $jobtype){ ?>
                                <?php 
                                    $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                    $lnks = JRoute::_($lnks);
                                    $lnks = $lnks . '?jobtype='. $jobtype->id;
                                ?>
                                <li><a href="<?php echo $lnks; ?>" ><?php echo $jobtype->title; ?></a> <span>(<?php echo $jobtype->typeinjobs; ?>)</span></li>
                                <?php
                                    $i += 1;
                                    if($i >= 3)
                                        break;
                                ?>
                            <?php } ?>
                            </ul>
                            <?php if(count($this->jobtypes) > 2) { ?>
                                <ul class="more-list">
                                <?php foreach($this->jobtypes as $jobtype){ ?>
                                    <?php 
                                        $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                        $lnks = JRoute::_($lnks);
                                        $lnks = $lnks . '?jobtype='. $jobtype->id;
                                    ?>
                                    <li><a href="<?php echo $lnks; ?>" ><?php echo $jobtype->title; ?></a> <span>(<?php echo $jobtype->typeinjobs; ?>)</span></li>
                                <?php } ?>
                                </ul>
                                <div class="job-option-block-more">
                                    <a href="#">See more...</a>
                                </div>
                            <?php } ?>
                        <?php } ?>
                    </div>
                </div>
                <div class="job-option-block">
                    <div class="job-option-block-header active">
                        <h3>Job duration</h3>
                        <a href="#">Expanse</a>
                    </div>
                    <div class="job-option-block-content">
                        <?php if ( isset($this->durations) ){ ?>
                            <ul class="default-list">
                            <?php $i = 0; ?>
                            <?php foreach($this->durations as $duration){ ?>
                                <?php 
                                    $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                    $lnks = JRoute::_($lnks);
                                    $lnks = $lnks . '?duration='. (($duration->duration > 0) ? $duration->duration : 0);
                                    $worktime = 'Unlimited';
                                    if($duration->duration == 1)
                                        $worktime = $duration->duration . ' Month';
                                    else if($duration->duration > 1)
                                        $worktime = $duration->duration . ' Months';
                                ?>
                                <li><a href="<?php echo $lnks; ?>" ><?php echo $worktime; ?></a> <span>(<?php echo $duration->durationinjobs; ?>)</span></li>
                                <?php
                                    $i += 1;
                                    if($i >= 3)
                                        break;
                                ?>
                            <?php } ?>
                            </ul>
                            <?php if(count($this->durations) > 2) { ?>
                                <ul class="more-list">
                                <?php foreach($this->durations as $duration){ ?>
                                    <?php 
                                        $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                    $lnks = JRoute::_($lnks);
                                    $lnks = $lnks . '?duration='. (($duration->duration > 0) ? $duration->duration : 0);
                                    $worktime = 'Unlimited';
                                    if($duration->duration == 1)
                                        $worktime = $duration->duration . ' Month';
                                    else if($duration->duration > 1)
                                        $worktime = $duration->duration . ' Months';
                                    ?>
                                    <li><a href="<?php echo $lnks; ?>" ><?php echo $worktime; ?></a> <span>(<?php echo $duration->durationinjobs; ?>)</span></li>
                                <?php } ?>
                                </ul>
                                <div class="job-option-block-more">
                                    <a href="#">See more...</a>
                                </div>
                            <?php } ?>
                        <?php } ?>
                    </div>
                </div>
                <div class="job-option-block">
                    <div class="job-option-block-header active">
                        <h3>Job status</h3>
                        <a href="#">Expanse</a>
                    </div>
                    <div class="job-option-block-content">
                        <?php if ( isset($this->statusjobs) ){ ?>
                            <ul class="default-list">
                            <?php $i = 0; ?>
                            <?php foreach($this->statusjobs as $statusjob){ ?>
                                <?php 
                                    $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                    $lnks = JRoute::_($lnks);
                                    $lnks = $lnks . '?jobstatus='. $statusjob->id;
                                ?>
                                <li><a href="<?php echo $lnks; ?>" ><?php echo $statusjob->title; ?></a> <span>(<?php echo $statusjob->statusinjobs; ?>)</span></li>
                                <?php
                                    $i += 1;
                                    if($i >= 3)
                                        break;
                                ?>
                            <?php } ?>
                            </ul>
                            <?php if(count($this->statusjobs) > 2) { ?>
                                <ul class="more-list">
                                <?php foreach($this->statusjobs as $statusjob){ ?>
                                    <?php 
                                        $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                        $lnks = JRoute::_($lnks);
                                        $lnks = $lnks . '?jobstatus='. $statusjob->id;
                                    ?>
                                    <li><a href="<?php echo $lnks; ?>" ><?php echo $statusjob->title; ?></a> <span>(<?php echo $statusjob->statusinjobs; ?>)</span></li>
                                <?php } ?>
                                </ul>
                                <div class="job-option-block-more">
                                    <a href="#">See more...</a>
                                </div>
                            <?php } ?>
                        <?php } ?>
                    </div>
                </div>
                <div class="job-option-block">
                    <div class="job-option-block-header active">
                        <h3>Salary range</h3>
                        <a href="#">Expand</a>
                    </div>
                    <div class="job-option-block-content">
                        <?php if ( isset($this->salaryranges) ){ ?>
                            <ul class="default-list">
                            <?php $i = 0; ?>
                            <?php foreach($this->salaryranges as $salaryrange){ ?>
                                <?php 
                                    $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                    $lnks = JRoute::_($lnks);
                                    $lnks = $lnks . '?salarystart='. $salaryrange->rangestart . '&salaryend=' . $salaryrange->rangeend;
                                ?>
                                <li><a href="<?php echo $lnks; ?>" ><?php echo $salaryrange->range . ' ' . $salaryrange->title; ?></a> <span>(<?php echo $salaryrange->rangeinjobs; ?>)</span></li>
                                <?php
                                    $i += 1;
                                    if($i >= 3)
                                        break;
                                ?>
                            <?php } ?>
                            </ul>
                            <?php if(count($this->salaryranges) > 2) { ?>
                                <ul class="more-list">
                                <?php foreach($this->salaryranges as $salaryrange){ ?>
                                    <?php 
                                        $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                        $lnks = JRoute::_($lnks);
                                        $lnks = $lnks . '?salarystart='. $salaryrange->rangestart . '&salaryend=' . $salaryrange->rangeend;
                                    ?>
                                    <li><a href="<?php echo $lnks; ?>" ><?php echo $salaryrange->range . ' ' . $salaryrange->title; ?></a> <span>(<?php echo $salaryrange->rangeinjobs; ?>)</span></li>
                                <?php } ?>
                                </ul>
                                <div class="job-option-block-more">
                                    <a href="#">See more...</a>
                                </div>
                            <?php } ?>
                        <?php } ?>
                    </div>
                </div>
                <div class="job-option-block">
                    <div class="job-option-block-header active">
                        <h3>Career level</h3>
                        <a href="#">Expanse</a>
                    </div>
                    <div class="job-option-block-content">
                        <?php if ( isset($this->careerlevels) ){ ?>
                            <ul class="default-list">
                            <?php $i = 0; ?>
                            <?php foreach($this->careerlevels as $careerlevel){ ?>
                                <?php 
                                    $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                    $lnks = JRoute::_($lnks);
                                    $lnks = $lnks . '?careerlevel='. $careerlevel->id;
                                ?>
                                <li><a href="<?php echo $lnks; ?>" ><?php echo $careerlevel->title; ?></a> <span>(<?php echo $careerlevel->careerlevelinjobs; ?>)</span></li>
                                <?php
                                    $i += 1;
                                    if($i >= 3)
                                        break;
                                ?>
                            <?php } ?>
                            </ul>
                            <?php if(count($this->careerlevels) > 3) { ?>
                                <ul class="more-list">
                                <?php foreach($this->careerlevels as $careerlevel){ ?>
                                    <?php 
                                        $lnks = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=list_jobs&jobcat=&Itemid='.$this->Itemid;
                                        $lnks = JRoute::_($lnks);
                                        $lnks = $lnks . '?careerlevel='. $careerlevel->id;
                                    ?>
                                    <li><a href="<?php echo $lnks; ?>" ><?php echo $careerlevel->title; ?></a> <span>(<?php echo $careerlevel->careerlevelinjobs; ?>)</span></li>
                                <?php } ?>
                                </ul>
                                <div class="job-option-block-more">
                                    <a href="#">See more...</a>
                                </div>
                            <?php } ?>
                        <?php } ?>
                    </div>
                </div>
            </div>
            <?php //End Browse Job Tab ?>
        </div>
        
        <div class="job-view-right">
            <div class="head-title">
                <h2><?php echo JText::_('JS_JOB_SEARCH_RESULT'); ?></h2>
            </div>
            <div class="job-view-content">
                <form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=job_apply&Itemid='. $this->Itemid); ?>" method="post" name="adminForm" id="adminForm">
                    <div class="job-view-select">
                        <div class="job-view-sort">
                            <span>Sort by:</span>
                            <?php
                                $sorttype = '';
                                if(isset($_GET['sortby'])) {
                                    if($_GET['sortby'] == 'createdasc' || $_GET['sortby'] == 'createddesc')
                                        $sorttype = 'created';
                                    if($_GET['sortby'] == 'salaryrangeasc' || $_GET['sortby'] == 'salaryrangedesc')
                                        $sorttype = 'salaryrange';
                                }
                            ?>
                            <a<?php echo ($sorttype == 'created')? ' class="active"':'' ?> href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['created']; ?>"><?php echo JText::_('Date'); ?></a>
                            <a<?php echo ($sorttype == 'salaryrange')? ' class="active"':'' ?> href="<?php echo $link?>&sortby=<?php echo $this->sortlinks['salaryrange']; ?>"><?php echo JText::_('Salary'); ?></a>
                        </div>
                        <?php 
							//don't need to check to display the apply button
							//if($allowed): ?>
                        <div class="apply-jobs">
                            <input type="submit" id="apply-multiple" class="button gradient-button" value="<?php echo JText::_('Multiple applies'); ?>">
                            <input type="hidden" name="view" value="jobseeker" />
                            <input type="hidden" name="layout" value="job_apply" />
                            <input type="hidden" name="uid" value="<?php echo $this->uid; ?>" />
                            <input type="hidden" name="option" value="<?php echo $this->option; ?>" />
                            <input type="hidden" name="aj" value="2" />
                        </div>
                        <?php //endif; ?>
                    </div>
                    <?php if(count($this->application)): ?>
                        <h1 class="results-summary">Your job search found <strong><?php echo count($this->application) ?></strong> matched job<?php echo (count($this->application) == 1)? '' : 's'; ?></h1>
                    <?php foreach($this->application as $app) { ?>
                    <div class="job-view-list">
                    	<div>
                            <input type="checkbox" class="checkbox-job" name="bi[]" value="<?php echo $app->id; ?>" /> 
                            <?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=view_job&vj=3&oi='.$app->id.'&Itemid='.$this->Itemid; ?>
                            <h3><a href="<?php echo $link?>"><?php echo $app->title; ?></a></h3>
                            <p class="introduction-text">
                                <span><?php echo date('d F Y',strtotime($app->startpublishing)); ?></span><span id="separator">|</span>
                                <span><?php echo !empty($app->cityname)?$app->cityname:$app->city; ?></span><span id="separator">|</span>
                                <?php $salary = $this->config['currency'] . $app->salaryfrom . ' - ' . $this->config['currency'] . $app->salaryend . ' ' . $app->salaytype;
                                if($app->salaryfrom){
                                    echo '<span>' . $salary . '</span>';
                                } ?>
                            </p>
                            <?php echo $app->description; ?>
                            <div class="job-emplyer-bottom">
                                <p class="job-employer">
                                    Employer: <?php echo $app->companyname; ?>
                                </p>
                                <?php $link = 'index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=job_apply&aj=2&bi='.$app->id.'&Itemid='.$this->Itemid; ?>
                                <a href="<?php echo $link?>"><?php echo JText::_('JS_APPLYNOW'); ?></a>
                            </div>
                        </div>
                    </div>
                    <?php } ?>

                    <div class="job-pagination">
                        <form action="<?php echo JRoute::_('index.php?option=com_wrecruit&c=wrecruit&view=jobseeker&layout=job_searchresults&Itemid='.$this->Itemid); ?>" method="post">
                            <?php echo $this->pagination->getPagesLinks();?>
                        </form>
                    </div>
                    <?php else: ?>
                    	<h1 class="results-summary">No matched job found from your search</h1>
                    <?php endif; ?>
                </form>
            </div>
            <?php if ($allowed) {?>
                <div class="save-job">
                    <form action="index.php" method="post" name="adminForm" id="adminForm" onsubmit="return myValidate(this);">
                        <input class="inputbox required" type="text" name="searchname" size="15" maxlength="30"  />&nbsp;&nbsp;&nbsp;
                        <input type="submit" class="button validate gradient-button-yellow" value="<?php echo JText::_('JS_SAVE'); ?>">
                        <input type="hidden" name="option" value="<?php echo $this->option; ?>" />
                        <input type="hidden" name="task" value="savejobsearch" />
                    </form>
                </div>
            <?php } ?>
        </div>
    </div>
</div>

<script language="javascript">
    function myValidate(f) {
        if (document.formvalidator.isValid(f)) {
            //f.check.value='<?php echo JUtility::getToken(); ?>';//send token
            //returnvalue = true; 
        }
        else {
            alert('Search name is not acceptable.  Please retry.');
            return false;
        }
        return true;
    }
	
	jQuery(document).ready(function(){
		jQuery.noConflict();
		jQuery('#apply-multiple').click(function(e){
			if (jQuery('input[name="bi[]"]:checked').length == 0) {
				// validation fails, so stop submit
				e.preventDefault();
				alert('Please select at least a job to apply');
			}else if (jQuery('input[name="bi[]"]:checked').length > 3){
				// validation fails, so stop submit
				e.preventDefault();
				alert('We allow to apply only to 3 jobs at the same time.');	
			}
		});
	});
</script>